class Ti2{
	public static void main(String[] args){
		int num = 0;
		for (int i = 1000;i>=100 ;i-- )
		{
			int ge =i%10;
			int shi = i/10%10;
			int bai = i/100%10;
			num = ge*ge*ge+shi*shi*shi+bai*bai*bai;
			if (i==num)
			{
				System.out.println(i);
				break;
			}


	}
}
}